home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / ActionDTHelper.java < prev    next >
Text File  |  1998-08-01  |  3KB  |  101 lines

  1. package com.symantec.itools.swing.actions;
  2.  
  3. import com.symantec.itools.vcafe.openapi.*;
  4. import com.symantec.itools.vcafe.openapi.beans.DesignTimeDnd;
  5. import com.symantec.itools.vcafe.openapi.beans.DesignTimeOnDrop;
  6.  
  7. public final class ActionDTHelper
  8.     implements DesignTimeDnd, DesignTimeOnDrop
  9. {
  10.     //
  11.     // DesignTimeDnd Implementation
  12.     //
  13.     
  14.     public boolean canAcceptDrag(VisualObject visualObject)
  15.     {
  16.         return false;
  17.     }
  18.     
  19.     public boolean canDragOnto(VisualObject visualObject)
  20.     {
  21.         if (visualObject.isRootObject())
  22.             return true;
  23.         
  24.         if (visualObject.isInstanceOf("com.sun.java.swing.JMenu"))
  25.             return true;
  26.         
  27.         if (visualObject.isInstanceOf("com.sun.java.swing.JToolBar"))
  28.             return true;
  29.         
  30.         return false;
  31.     }
  32.     
  33.     public boolean abortAcceptDrag(VisualObject visualObject)
  34.     {
  35.         return !canDragOnto(visualObject);
  36.     }
  37.     
  38.     public boolean abortDragOnto(VisualObject visualObject)
  39.     {
  40.         return false;
  41.     }
  42.     
  43.     //
  44.     // DesignTimeOnDrop Implementation
  45.     //
  46.     
  47.     public void onDrop(VisualObject actionRefVO)
  48.     {
  49.         /*
  50.         //Since Actions are roots as well, we ignore those
  51.         if (!actionRefVO.isRootObject())
  52.         {
  53.             //Find the reference at the root level that the actionRefVO also refers to
  54.             VisualObject actionRootVO = null;
  55.             {
  56.                 String objectName = actionRefVO.getName();
  57.                 
  58.                 VisualObject stepVO = actionRefVO.getRootObject().getFirstChild();
  59.                 while(stepVO != null)
  60.                 {
  61.                     if (stepVO.getName().equals(objectName))
  62.                     {
  63.                         actionRootVO = stepVO;
  64.                         break;
  65.                     }
  66.                     
  67.                     stepVO = stepVO.getSibling();
  68.                 }
  69.             }
  70.             
  71.             System.out.println("actionRootVO = " + actionRootVO);
  72.             
  73.             VisualObject parent = actionRefVO.getParent();
  74.             if (parent != null)
  75.             {
  76.                 String className =
  77.                     parent.isInstanceOf("com.sun.java.swing.JToolBar") ?
  78.                         "com.symantec.itools.swing.actions.JActionButton" :
  79.                         "com.symantec.itools.swing.actions.JActionMenuItem";
  80.                 //System.out.println("className = " + className);
  81.                 
  82.                 VisualObject actionObject = VisualCafe.getVisualCafe().createVisualObjectByName(className);
  83.                 //System.out.println("actionObject = " + actionObject);
  84.                 
  85.                 //VisualProperty properties[] = actionObject.getProperties();
  86.                 //for (int i = 0; i < properties.length; i++)
  87.                 //     if (properties[i] != null)
  88.                 //        System.out.println(properties[i].getInternalPropertyName());
  89.                 
  90.                 VisualProperty actionProperty = actionObject.findProperty("ipnaction");
  91.                 //System.out.println("actionProperty = " + actionProperty);
  92.                 
  93.                 
  94.                 
  95.                 //actionProperty.setReferencedVisualObjectID();
  96.             }
  97.         }
  98.         */
  99.     }
  100. }
  101.